package com.x.erp.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.x.erp.dao.MultilevelActivityCashDao;
import com.x.erp.manage.MultilevelActivityCashManage;
import com.x.erp.model.MultilevelActivityCash;
import com.x.erp.rpc.MultilevelActivityCashRpcService;
import com.x.framework.exception.BusinessException;
import com.x.framework.exception.ExceptionCode;
import com.x.framework.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 多级营销提现记录服务
 */
@Component
@Service(interfaceName = "com.x.erp.rpc.MultilevelActivityCashRpcService", timeout = 60000)
public class MultilevelActivityCashService extends BaseService implements MultilevelActivityCashRpcService {

	@Autowired
	private MultilevelActivityCashDao multilevelActivityCashDao;//多级营销提现记录信息DAO

	@Autowired
	private MultilevelActivityCashManage multilevelActivityCashManage;//多级营销提现记录信息Manage

	/**
	 * 查询多级营销提现记录列表
	 * @param multilevelActivityCash
	 * @return
	 */
	@Override
	public List<MultilevelActivityCash> selectMultilevelActivityCashList(MultilevelActivityCash multilevelActivityCash){
		try {
			return multilevelActivityCashDao.selectMultilevelActivityCashList(multilevelActivityCash);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 查询多级营销提现记录数量
	 * @param multilevelActivityCash
	 * @return
	 */
	@Override
	public int selectMultilevelActivityCashNum(MultilevelActivityCash multilevelActivityCash) {
		try {
			return multilevelActivityCashDao.selectMultilevelActivityCashNum(multilevelActivityCash);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 新增多级营销提现记录信息
	 * @param multilevelActivityCash
	 * @return
	 */
	@Override
	public MultilevelActivityCash insertMultilevelActivityCash(MultilevelActivityCash multilevelActivityCash){
		try {
			return multilevelActivityCashManage.insertMultilevelActivityShare(multilevelActivityCash);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 修改多级营销提现记录信息
	 * @param multilevelActivityCash
	 * @return
	 */
	@Override
	public int updateMultilevelActivityCash(MultilevelActivityCash multilevelActivityCash){
		try {
			return this.update(multilevelActivityCash);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	@Override
	public int deleteMultilevelActivityCash(MultilevelActivityCash multilevelActivityCash) {
		try {
			return this.delete(multilevelActivityCash);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

}
